import request from '@/utils/request'

export const menuEditGet = function(params){
  return request({
    url: '/rule/edit',
    method: 'get',
    params: params
  })
}

export const menuEditPost = function(params){
  return request({
    url: '/rule/edit',
    method: 'post',
    data: params
  })
}

export const menuList = function(params){
  return request({
    url: '/rule/list',
    method: 'get',
    params: params
  })
}


export const menuRuleTree  = function(){
  return request({
    url: '/rule/auth_rule_tree',
    method: 'get',
  })
}

export const menuStatusChange =function(params){
  let url = '/rule/status_switch?id='+params.id
  delete params.id
  return request({
    url: url,
    method: 'post',
    data: params
  })
}

export const menuNameList = function(){
  return request({
    url: '/rule/name',
    method: 'get',
  })
}

export const menuRuleTreeList = function(){
  return request({
    url: '/rule/rule_tree',
    method: 'get',
  })
}

export const menuAdd = function(params){
  return request({
    url: '/rule/add',
    method: 'post',
    data: params
  })
}
export const menuDel = function(params){
  return request({
    url: '/rule/del',
    method: 'post',
    data: params,
  })
}

export const login = function(){
  return request({
    url:'/public/getlogin',
    method: 'get',
  })
}